package com.dingwen.treasure.tkmybatis.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.dingwen.treasure.base.enums.LogicDeleteEnum;
import com.dingwen.treasure.tkmybatis.convert.LogicDeleteEnumHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import tk.mybatis.mapper.annotation.ColumnType;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 　TreasureFile: TODO @table(name="")问题
 * 　@author dingwen
 * 　@date 2022/7/4
 */
@ApiModel(value = "TreasureFile", description = "文件实体")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Accessors(chain = true)
public class TreasureFile implements Serializable {

    private static final long serialVersionUID = -2862023086991299158L;
    @ApiModelProperty(value = "文件ID")
    @Id
    @GeneratedValue(generator = "JDBC")
    @Column(insertable = false, name = "file_id")
    private Long fileId;

    @ApiModelProperty(value = "文件名称")
    private String fileName;

    @ApiModelProperty(value = "原始文件名称")
    private String originalFileName;

    @ApiModelProperty(value = "文件类型")
    private String fileType;

    @ApiModelProperty(value = "文件大小")
    private Long fileSize;

    @ApiModelProperty(value = "业务ID")
    private Long businessId;

    @ApiModelProperty(value = "存储桶名称")
    private String bucketName;

    @ApiModelProperty(value = "地址")
    private String url;

    @ApiModelProperty(value = "所属用户")
    private Long userId;

    @ApiModelProperty(value = "所属组")
    private String groupName;

    @ApiModelProperty(value = "下载次数")
    private Integer download;

    @ApiModelProperty(value = "对象名称")
    private String objectName;

    @ApiModelProperty(value = "创建人")
    private String createBy;

    @ApiModelProperty(value = "删除人")
    private String deleteBy;

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "文件是否已删除")
    @ColumnType(typeHandler = LogicDeleteEnumHandler.class)
    // TODO 自定义枚举转换有问题 @ExcelProperty(converter = LogicDeleteEnumConverter.class)
    @ExcelIgnore
    private LogicDeleteEnum deleted;


    @ApiModelProperty(value = "备注")
    private String remark;

}
